home *** CD-ROM | disk | FTP | other *** search
- /* rot13 - Ein Prg zum decodieren von rot13 */
-
- #include <stdio.h>
- //#include <stdlib.h>
- //#include <ctype.h>
-
-
- int main(int argc, char **argv)
- {
- char *ABC;
- char *abc;
- int c;
- FILE *in, *out;
-
- if (argc != 3)
- {
- printf ("$VER: ROT13 1.0 (25.10.94)");
- printf ("\ngeschrieben von Helmut Kindler");
- printf ("\n\nAufruf: %s <infile> <outfile>\n", argv[0]);
- exit(0);
- }
-
- if ((in = fopen (argv[1], "r")) == NULL)
- {
- printf ("%s: Kann \"%s\" nicht zum Lesen öffnen\n", argv[0], argv[1]);
- exit(0);
- }
-
- if ((out = fopen (argv[2], "w")) == NULL)
- {
- printf ("%s: Kann \"%s\" nicht zum Schreiben öffnen\n", argv[0], argv[2]);
- fclose (in);
- exit(0);
- }
-
- ABC = "NOPQRSTUVWXYZABCDEFGHIJKLM";
- abc = "nopqrstuvwxyzabcdefghijklm";
-
- while ((c = fgetc (in)) != EOF)
- {
- //if (isupper(c))
- if ((c>='A') & (c<='Z'))
- {
- c = c - 'A';
- c = ABC[c];
- }
- //if (islower(c))
- if ((c>='a') & (c<='z'))
- {
- c = c - 'a';
- c = abc[c];
- }
- fprintf (out, "%c", c);
- }
- fclose (in);
- fclose (out);
- }
-
-